import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import path from 'path'

const pathResolve = (dir: string) =>path.resolve(__dirname, dir)

// https://vitejs.dev/config/
export default defineConfig({
  // 路径别名配置
  resolve: {
    alias: {
      '@/':  `${pathResolve('src')}/`,
      '#/': `${pathResolve('types')}/`,
    },
  },
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
})
